/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entityprojet;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author T.Ron
 */
@Entity
@Table(name = "COMPTER")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Compter.findAll", query = "SELECT c FROM Compter c"),
    @NamedQuery(name = "Compter.findByIdCr", query = "SELECT c FROM Compter c WHERE c.idCr = :idCr"),
    @NamedQuery(name = "Compter.findByNumcr", query = "SELECT c FROM Compter c WHERE c.numcr = :numcr"),
    @NamedQuery(name = "Compter.findByTypecr", query = "SELECT c FROM Compter c WHERE c.typecr = :typecr"),
    @NamedQuery(name = "Compter.findByIntitulecr", query = "SELECT c FROM Compter c WHERE c.intitulecr = :intitulecr")})
public class Compter implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_CR")
    private Integer idCr;
    @Basic(optional = false)
    @Column(name = "NUMCR")
    private String numcr;
    @Basic(optional = false)
    @Column(name = "TYPECR")
    private short typecr;
    @Basic(optional = false)
    @Column(name = "INTITULECR")
    private String intitulecr;
    @OneToMany(mappedBy = "idCr")
    private Collection<Compteg> comptegCollection;

    public Compter() {
    }

    public Compter(Integer idCr) {
        this.idCr = idCr;
    }

    public Compter(Integer idCr, String numcr, short typecr, String intitulecr) {
        this.idCr = idCr;
        this.numcr = numcr;
        this.typecr = typecr;
        this.intitulecr = intitulecr;
    }

    public Integer getIdCr() {
        return idCr;
    }

    public void setIdCr(Integer idCr) {
        this.idCr = idCr;
    }

    public String getNumcr() {
        return numcr;
    }

    public void setNumcr(String numcr) {
        this.numcr = numcr;
    }

    public short getTypecr() {
        return typecr;
    }

    public void setTypecr(short typecr) {
        this.typecr = typecr;
    }

    public String getIntitulecr() {
        return intitulecr;
    }

    public void setIntitulecr(String intitulecr) {
        this.intitulecr = intitulecr;
    }

    @XmlTransient
    public Collection<Compteg> getComptegCollection() {
        return comptegCollection;
    }

    public void setComptegCollection(Collection<Compteg> comptegCollection) {
        this.comptegCollection = comptegCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCr != null ? idCr.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Compter)) {
            return false;
        }
        Compter other = (Compter) object;
        if ((this.idCr == null && other.idCr != null) || (this.idCr != null && !this.idCr.equals(other.idCr))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entityprojet.Compter[ idCr=" + idCr + " ]";
    }
    
}
